<?php

namespace App\Http\Resources\School;

use Illuminate\Http\Resources\Json\Resource;

/**
 * Class BookOrderResource
 * @package App\Http\Resources\Backend
 */
class CheckoutOrderResource extends Resource
{
    /**
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'rule' => $this->whenLoaded('rule'),
            'user' => $this->whenLoaded('user'),
            'review'=> $this->whenLoaded('review'),
            'created_at'=> $this->created_at->format("Y-m-d H:i:s"),
            'type'=> $this->type,
            'status_label'=> $this->status_label,
            'type_label'=> $this->type_label,
            'eat_date' => $this->rule->eat_date,
            'eat_type_label'=>$this->rule->type_label,
        ];
    }
}
